module.exports = (app) => {
  const mongoose = app.mongoose;
  const Schema = mongoose.Schema;

  const SpuSaleAttrsSchema = new Schema({
    baseSaleAttrId: {
      type: Schema.Types.ObjectId,
      required: true,
    },
    saleAttrName: {
      type: String,
      required: true,
    },
    // spuId: {
    //   type: Schema.Types.ObjectId,
    //   required: true,
    // },
    spuSaleAttrValueList: [
      {
        isChecked: {
          type: String,
          required: true,
        },
        saleAttrValueName: {
          type: String,
          required: true,
        },
      },
    ],
    isAdmin: {
      type: Boolean,
      default: false,
    },
  });

  return mongoose.model("SpuSaleAttrs", SpuSaleAttrsSchema, "SpuSaleAttrs");
};
